/**
* 弹窗组件，使用： this.$store.dispatch('setModal',{visible:true，modalId:'modlaId'}); 注意this指向的上下文环境，有时候是写self或其它
*/
<template>
  <transition name="slide-fade">
    <div v-if="modal.visible && modal.modalId=='gameRegisterSuccModal'" class="modal" id="gameRegisterSuccModal" tabindex="-1" @click.stop.prevent="modalHide">
      <div class="modal-dialog" @click.stop.prevent>
        <div class="modal-content">
          <img src="~assets/images/tankuang.png" class="img-responsive">
          <img src="~assets/images/close@2x.png" data-dismiss="modal" class="img-close" @click.stop.prevent="modalHide">
          <div class="oxhead">
            <img src="https://dl.app.gtja.com/nrng/shareimages/oxhead/niugaoxing.png">
          </div>
          <div class="wrapper">
            <h4><span>比赛报名成功</span></h4>
            <button type="button" class="btn btn-lg btn-agree">
              <span class="count-down">{{second}}</span> 秒跳转到比赛
            </button>
          </div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
  import BaseModal from 'components/modal/BaseModal'

  export default {
    data () {
      return {
        second:3
      }
    },
    extends:BaseModal,
    updated:function(){
      var self = this
      if(self.modal.modalId == 'gameRegisterSuccModal'){
        setTimeout(function () {
          console.log(self.second)
          self.second--;
          if (self.second <= 0) {
            window.location.reload(true);
          }
        }, 1000)
      }
    }
  }
</script>

<style scoped>
  .slide-fade-enter-active,.slide-fade-leave-active{
    transition: all 0.3s ease;
  }
  .slide-fade-enter, .slide-fade-leave-active {
    transform: translate(0,-25%);
    opacity: 0;
  }
</style>
